using MediatR;
using RBAC.ErrorCode;
using System.ComponentModel.DataAnnotations;

namespace RBAC.Read.Api.Application.Command.ERP.SalesManagement.Billing
{
    /// <summary>
    /// 获取开票明细列表查询命令
    /// </summary>
    public class GetBillingDetailListCommand : IRequest<APIResult<GetBillingDetailListDto>>
    {
        /// <summary>
        /// 当前页码，默认第1页
        /// </summary>
        [Range(1, int.MaxValue)]
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页条数，默认10条
        /// </summary>
        [Range(1, 100)]
        public int PageSize { get; set; } = 10;

        /// <summary>
        /// 单据编号（模糊查询）
        /// </summary>
        public string? BillNo { get; set; }

        /// <summary>
        /// 客户名称（模糊查询）
        /// </summary>
        public string? CustomerName { get; set; }

        /// <summary>
        /// 开票名称（模糊查询）
        /// </summary>
        public string? InvoiceName { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime? StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime? EndDate { get; set; }
    }

    /// <summary>
    /// 开票明细列表响应DTO
    /// </summary>
    public class GetBillingDetailListDto
    {
        /// <summary>
        /// 分页数据列表
        /// </summary>
        public List<BillingDetailDto> PageDatas { get; set; } = new List<BillingDetailDto>();

        /// <summary>
        /// 总记录数
        /// </summary>
        public int TotalCount { get; set; }
    }

    /// <summary>
    /// 开票明细DTO
    /// </summary>
    public class BillingDetailDto
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        public long Id { get; set; }

        /// <summary>
        /// 单据编号
        /// </summary>
        public string? BillNumber { get; set; }

        /// <summary>
        /// 客户名称
        /// </summary>
        public string? CustomerName { get; set; }

        /// <summary>
        /// 单据日期
        /// </summary>
        public DateTime? BillDate { get; set; }

        /// <summary>
        /// 销售订单号
        /// </summary>
        public string? OrderNumber { get; set; }

        /// <summary>
        /// 物料编码
        /// </summary>
        public string? MaterialCode { get; set; }

        /// <summary>
        /// 物料名称
        /// </summary>
        public string? MaterialName { get; set; }

        /// <summary>
        /// 规格型号
        /// </summary>
        public string? Specification { get; set; }

        /// <summary>
        /// 主计量单位
        /// </summary>
        public string? Unit { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public int? Quantity { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal? UnitPrice { get; set; }

        /// <summary>
        /// 金额
        /// </summary>
        public decimal? Amount { get; set; }

        /// <summary>
        /// 开票名称
        /// </summary>
        public string? InvoiceName { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }

        /// <summary>
        /// 单据状态
        /// </summary>
        public string? BillStatus { get; set; }
    }
}